import { Injectable } from '@angular/core';
import { Http } from '@angular/http';

@Injectable()
export class MyAppService {
    //private lppUrl = 'http://localhost:3661';
    private lppUrl = 'http://lpp.arktao.com';

    constructor(private http: Http) { }
    //获取我的常用应用列表
    GetMyAppList(UserGuid): Promise<any> {
        return this.http.get(this.lppUrl + "/MyApp/MyAppList/" + UserGuid + "")
            .toPromise().then(res => { return res.json() })
    }
    //获取我的所有应用列表
    GetAllMyAppList(UserGuid): Promise<any> {
        return this.http.get(this.lppUrl + "/MyApp/GetAllMyAppList/" + UserGuid + "")
            .toPromise().then(res => { return res.json() })
    }
    //移除我的常用应用
    RemoveCommonMyApp(MyAppGuid): Promise<any> {
        return this.http.delete(this.lppUrl + "/MyApp/RemoveCommonMyApp/" + MyAppGuid + "")
            .toPromise().then(res => { return res.json() })
    }
    //移除我的应用
    RemoveMyApp(MyAppGuid): Promise<any> {
        return this.http.delete(this.lppUrl + "/MyApp/RemoveMyApp/" + MyAppGuid + "")
            .toPromise().then(res => { return res.json() })
    }
    //恢复常用应用
    RecoverCommonMyApp(MyAppGuid): Promise<any> {
        return this.http.post(this.lppUrl + "/MyApp/RecoverCommonMyApp/" + MyAppGuid + "", {})
            .toPromise().then(res => { return res.json() })
    }
    //点击增加浏览数
    AddMyAppPageView(MyAppGuid): Promise<any> {
        return this.http.post(this.lppUrl + "/MyApp/AddMyAppPageView/" + MyAppGuid + "", {})
            .toPromise().then(res => { return res.json() })
    }
}